<?php
	/**
	 * Zend 默认错误页面
	 */
	class ErrorController extends HomeController {
		
		function errorAction() {

			$log = Zend_Registry::get('logger');
			$errors = $this -> _getParam('error_handler');

			/*设置错误提醒*/
				
			switch($errors->type){
				/*404 错误*/
				case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ROUTE:
				case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
				case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
                $this->getResponse()->setHttpResponseCode(404);
                $this->view->message = 'Page not found';
				$error_type = "404";
                break;

				/*内部错误*/
				default:
					$error_type = "basic";
					$exception = $errors -> exception;
					$content = "PRO Error";
					if(INDEBUG) {
						//详细信息$content = $exception -> getMessage() . PHP_EOL . $exception -> getTraceAsString();
						$content = $exception -> getMessage();
					}
					$log -> err($exception -> getMessage() . PHP_EOL . $exception -> getTraceAsString());
				break;
			}
			$this->view->content = $content;
			$this->view->type = $error_type;
		}
	}